package com.itheima02.day03;

import java.util.Scanner;

/**
 * @author 刘全
 * @date 2021/7/18
 */
public class test06 {
    public static void main(String[] args) {
        method(new IGetString() {
            @Override
            public String get() {
                Scanner sc = new Scanner(System.in);
                System.out.println("请输入一个字符串:");
                String s = sc.nextLine();
                return s;
            }
        });
        method(() -> {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入一个字符串:");
            String s = sc.nextLine();
            return s;
        });
    }
    public static void method(IGetString iGetString){
        String s = iGetString.get();
        System.out.println(s);
    }
}
interface IGetString{
    String get();
}